package day05;

import java.util.Arrays;

public class ArrayDemo {
    public static void main(String[] args) {
        /*
        int[] a=new int[5];
        int[] b={2,3,4};
        int[] c=new int[]{2,3,4};
        int[] d;
        d=new int[]{2,3,4};
        a[2]=5;
        System.out.println(a.length);

         */
        int[] a=new int[10];
        for (int i=0;i<a.length;i++){
            a[i]=(int)(Math.random()*100);
            System.out.println(a[i]);
        }
        Arrays.sort(a);
        System.out.println("排序后：");
        for (int i=0;i<a.length;i++){
            System.out.println(a[i]);
        }
        System.out.println("到排序后：");
        for (int i=a.length-1;i>=0;i--){
            System.out.println(a[i]);
        }
        /*
        int max = a[0];
        for (int i=1;i<a.length;i++){
            if (max<a[i]){
                max=a[i];
            }
        }
        System.out.println("最大值："+max);
        int min=a[0];
        for (int i=1;i<a.length;i++){
            if (min>a[i]){
                min=a[i];
            }
        }
        System.out.println("最小值："+min);

         */
    }

}
